package com.zfl.practice;

import java.util.concurrent.atomic.AtomicReference;

public class AtomicReferenceDemo01 {
    public static void main(String[] args) {
        User user1 = new User("zfl", 20);
        AtomicReference<User> zfl = new AtomicReference<>(user1);
        System.out.println(zfl.get());
        User user2   = user1;
        User qy = new User("qy", 20);

        boolean res = zfl.compareAndSet(user2, qy);
        System.out.println("zfl = " + zfl.get());
        System.out.println("res = " + res);
    }
}
